package com.cedric.yixianpai.game.cards.Sects.swordCards.d_YuanYing;

import com.cedric.yixianpai.game.Constants.CardType;
import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class BaiLuLingJian extends SwordCard {
    private int damagePerSE=0;
    /**
     * title:白鹭灵剑
     * effect:SE-1 5攻（每剩余1点灵气多2/3/4攻）
     * */
    public BaiLuLingJian(@Value("1") int lvl) {
        super("白鹭灵剑");
        this.setLevel(lvl);
        this.setPeriod(Period.YUANYING);
        this.setDescription("灵气-1 5攻（每剩余1点灵气多2/3/4攻）");
        this.setCardType(CardType.LING);
        this.setDamage(5);
        this.setSpiritNeed(1);
        if (1 == lvl) {
            this.damagePerSE=2;
        } else if (2 == lvl) {
            this.damagePerSE=3;
        } else if (3 == lvl) {
            this.damagePerSE=4;
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        if(Sta1.spiritEnough(this.getSpiritNeed())){
            int dmg=this.getDamage()+Sta1.getPlayerBuff().getSpiritualEnergy()*this.damagePerSE;
            Sta1.attack(Sta2,dmg);
            Sta1.getPlayerBuff().clearSwordIntent();
            return true;
        }
        return false;
    }
}
